<%@ page language="java" contentType="text/html; charset=UTF-8"
    pageEncoding="UTF-8" isELIgnored="false"%>
<%@include file="/resources/common/commonTaglibs.jsp" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN" "http://www.w3.org/TR/html4/loose.dtd">
<html>
<head>
<meta http-equiv="Content-Type" content="text/html; charset=UTF-8">
<!-- 导入资源文件 -->
<%@include file="/resources/common/commonJs.jsp" %>
<%@include file="/resources/common/commonCss.jsp" %>
<title>校车预约</title>
<style type="text/css">
.addTable{
	line-height: 30px;
	border:solid 1px #cbcbcb; /* 设置边框属性；样式(solid=实线)、颜色(#999=灰) */
	text-align: center;
}
.addTable td{
	border:solid 1px #cbcbcb;
	text-align: center;
	letter-spacing:2px;
	width: 10%;
}
</style>
<script type="text/javascript">
function saveBusBespeakRecord() {
	if (!getSubmitFlag($('#busBespwakForm'))) {
		layer.alert('请先验证填写的字段');
		return false;
	}
	
	//获取申请时间
	var applyTime = $('input[name="applyTime"]').val();
	//获取车次id
	var busScheduleId = '${busSchedule.id}';
	$.post('${path}/busBespeak/saveBusBespeakRecord', {
		'applyTime': applyTime,
		'busSchedule.id': busScheduleId
	}, function(data) {
		if (data == '1') {
			layer.alert('预约成功!');
		} else if (data == '0') {
			layer.alert('预约失败, 请稍后重试!');
		}
	}, 'json');
}

$(function() {
	// 仅选择日期
	$(".form-date").datetimepicker(	{
	    language:  "zh-CN",
	    weekStart: 1,
	    todayBtn:  1,
	    autoclose: 1,
	    todayHighlight: 1,
	    startView: 2,
	    minView: 2,
	    forceParse: 0,
	    format: "yyyy-mm-dd",
	    startDate: new Date()
	});
	$("input").blur(function() {
		validateInput(this);
	});
})
</script>
</head>
<body>
<div align="center" style="margin: 20px 1% 0 1% ">
<form action="${path }/busBespeak/saveBusBespeakRecord" method="post" id="busBespwakForm">
<table  cellpadding="0" cellspacing="0"  align="center" class="addTable" style="text-align:center">
	<tr><td colspan="4" align="center">校车预约</td></tr>
	<tr>
		<td>出发地址：</td>
		<td>${busSchedule.startStation == 1 ? '金花校区' : '临潼校区' }</td>
		<td>到达地址：</td>
		<td>${busSchedule.endStation == 1 ? '金花校区' : '临潼校区' }</td>
	</tr>
	<tr>
		<td>出发时刻：</td>
		<td>${busSchedule.startTime }</td>
		<td>到达时刻：</td>
		<td>${busSchedule.endTime }</td>
	</tr>
	<tr>
		<td >预约车次：</td>
		<td>${busSchedule.scheduleNo }</td>
		<td>申请车次时间：</td>
		<td><input name="applyTime" type="text" value="" class="form-control form-date"/></td>	
	</tr>
	 <tr>
		<td colspan="4">
		<input type="button" value="保存" class="btn btn-primary" onclick="saveBusBespeakRecord()"/>
		<input type="reset" value="重置" class="btn"/>
		</td>
	</tr>
</table>
</form>
</div>
</body>
</html>